# coding=utf-8
# @Author: back
# @Time: 2024/10/14 10:11
from PySide6.QtCore import *
from PySide6.QtWidgets import *
from ui.mainwin_ui import *


class UiFunction(QMainWindow):
    # Expand left menu
    def __init__(self):
        super().__init__()
        self.ui = UiMainWindow()
        # self.toggleMenu(self)

    def toggleMenu(self, enable=True):
        if enable:
            standard = 75
            maxExtend = 160
            width = self.ui.leftmenu.width()

            if width == 75:
                width_extended = standard

            else:
                width_extended = maxExtend

            # animation
            self.animation = QPropertyAnimation(self.ui.leftmenu, b"minimumWidth")
            self.animation.setDuration(500)  # ms
            self.animation.setStartValue(QRect(0, 0, 75, 647))
            self.animation.setEndValue(QRect(0, 0, 160, 647))
            self.animation.setEasingCurve(QEasingCurve.Type.InOutQuint)
            self.animation.start()
